package com.wang.tool.hook;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.ApplicationContextAware;

/**
 * @Description 程序钩子
 * 1.该bean加载时机较早不要依赖其他普通bean
 * 2.@Value/@Resource/@Autowired等注解不生效
 * @Author shaopeng
 * @Date 2022/9/8
 * @Version 1.0
 */
public interface AppHook extends ApplicationContextAware, BeanFactoryPostProcessor, DisposableBean {


    @Override
    default void destroy() throws Exception {
//        空实现
    }

    @Override
    default void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
//        为了使该类今早初始化
    }
}
